#include <iostream>
#include <math.h>

using namespace std;

int main()
{
	const unsigned int X = 10001;
    unsigned int i = 3, j, n = 2, d;
    int * p = new int[X];
    p[0] = 2;
    p[1] = 3;
    while(n < X)
    {
        d = int(sqrt(i+=2));
        j = 1;
        while(d >= p[j] && i%p[j]) j++;
        if(d < p[j])
            p[n++] = i;
    }
    cout << i << endl;
};
